package org.csu.spring.demo.aop.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyDemo implements InvocationHandler {

    private Object object;

    public ProxyDemo(Object object){
        this.object = object;
    }

    @Override
    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
        beforeAdvice();
        Object proxyObject = method.invoke(object,objects);
        return proxyObject;
    }

    public void beforeAdvice(){
        System.out.println("前置建议：日志记录");
    }
}
